Class View.DisplaySprite
Represents a display sprite.
Functions
DisplaySprite(objectID, index, pos, rot, scale, [color]) | Create a DisplaySprite object. |
DisplaySprite(pos, rot, scale, [color]) | Create a DisplaySprite object with a video image. |
DisplaySprite:GetObjectID() | Get the object ID of the sprite sequence object used by the display sprite. |
DisplaySprite:GetSpriteID() | Get the sprite ID in the sprite sequence object used by the display sprite. |
DisplaySprite:GetPosition() | Get the display position of the display sprite in percent. |
DisplaySprite:GetRotation() | Get the rotation of the display sprite in degrees. |
DisplaySprite:GetScale() | Get the horizontal and vertical scale of the display sprite in percent. |
DisplaySprite:GetColor() | Get the color of the display sprite. |
DisplaySprite:SetObjectID(objectID) | Set the sprite sequence object ID used by the display sprite. |
DisplaySprite:SetSpriteID(spriteID) | Set the sprite ID in the sprite sequence object used by the display sprite. |
DisplaySprite:SetPosition(position) | Set the display position of the display sprite in percent. |
DisplaySprite:SetRotation(rotation) | Set the rotation of the display sprite in degrees. |
DisplaySprite:SetScale(scale) | Set the horizontal and vertical scale of the display sprite in percent. |
DisplaySprite:SetColor(color) | Set the color of the display sprite. |
DisplaySprite:Draw([priority], [alignMode], [scaleMode], [blendMode]) | Draw the display sprite in display space for the current frame. |
Functions
- DisplaySprite(objectID, index, pos, rot, scale, [color])
-
Create a DisplaySprite object.
Parameters:
- objectID SpriteConstants ID of the sprite sequence object.
- index int Index of the sprite in the sequence.
- pos Vec2 Display position in percent.
- rot float Rotation in degrees.
- scale Vec2 Horizontal and vertical scale in percent. Scaling is interpreted by the DisplaySpriteEnum.ScaleMode passed to the Draw() function call.
- color Color Color. Default: Color(255, 255, 255).
Returns:
-
DisplaySprite
A new DisplaySprite object.
- DisplaySprite(pos, rot, scale, [color])
-
Create a DisplaySprite object with a video image.
Video should be played using View.PlayVideo function in a background mode. If no video is played, sprite will not show.
Parameters:
- pos Vec2 Display position in percent.
- rot float Rotation in degrees.
- scale Vec2 Horizontal and vertical scale in percent. Scaling is interpreted by the DisplaySpriteEnum.ScaleMode passed to the Draw() function call.
- color Color Color. Default: Color(255, 255, 255, 255) Optional.
Returns:
-
DisplaySprite
A new DisplaySprite object with attached video image.
- DisplaySprite:GetObjectID()
-
Get the object ID of the sprite sequence object used by the display sprite.
Returns:
-
SpriteConstants
Sprite sequence object ID.
- DisplaySprite:GetSpriteID()
-
Get the sprite ID in the sprite sequence object used by the display sprite.
Returns:
-
int
Sprite ID in the sprite sequence object. Value -1 means that it is a background video, played using View.PlayVideo.
- DisplaySprite:GetPosition()
-
Get the display position of the display sprite in percent.
Returns:
-
Vec2
Display position in percent.
- DisplaySprite:GetRotation()
-
Get the rotation of the display sprite in degrees.
Returns:
-
float
Rotation in degrees.
- DisplaySprite:GetScale()
-
Get the horizontal and vertical scale of the display sprite in percent.
Returns:
-
Vec2
Horizontal and vertical scale in percent.
- DisplaySprite:GetColor()
-
Get the color of the display sprite.
Returns:
-
Color
Color.
- DisplaySprite:SetObjectID(objectID)
-
Set the sprite sequence object ID used by the display sprite.
Parameters:
- objectID SpriteConstants New sprite sequence object ID.
- DisplaySprite:SetSpriteID(spriteID)
-
Set the sprite ID in the sprite sequence object used by the display sprite.
Parameters:
- spriteID int New sprite ID in the sprite sequence object.
- DisplaySprite:SetPosition(position)
-
Set the display position of the display sprite in percent.
Parameters:
- position Vec2 New display position in percent.
- DisplaySprite:SetRotation(rotation)
-
Set the rotation of the display sprite in degrees.
Parameters:
- rotation float New rotation in degrees.
- DisplaySprite:SetScale(scale)
-
Set the horizontal and vertical scale of the display sprite in percent.
Parameters:
- scale float New horizontal and vertical scale in percent.
- DisplaySprite:SetColor(color)
-
Set the color of the display sprite.
Parameters:
- color Color New color.
- DisplaySprite:Draw([priority], [alignMode], [scaleMode], [blendMode])
-
Draw the display sprite in display space for the current frame.
Parameters:
- priority int Draw priority. Can be thought of as a layer, with higher values having precedence. Default: 0.
- alignMode AlignMode Align mode interpreting an offset from the sprite's position. Default: View.AlignMode.CENTER.
- scaleMode ScaleMode Scale mode interpreting the display sprite's horizontal and vertical scale. Default: View.ScaleMode.FIT.
- blendMode BlendID Blend mode. Default: Effects.BlendID.ALPHABLEND.